<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/11 0011
 * Time: 下午 20:02
 */
namespace Home\Controller;
use Core\Controller;
use Core\DB;
class RunController extends Controller{
    public function index(){
        $where['truename']="??";
        $where['bind_userid#<>']="";
        $data = DB::table('user')->where($where)->select();
        echo count($data);exit;
        foreach($data as $value){
            $condition['user_id'] = $value['bind_userid'];
            $rs = DB::table('user1')->where($condition)->find();
            $update['truename'] = $rs['user_name'];
            $where1['id'] = $value['id'];
            $result = DB::table('user')->where($where1)->data($update)->update();
        }
    }
    public function makestr(){
        $url = '1.txt';
        $data = GetData($url);
        $unique_arr = array_unique ( $data );
        // 获取重复数据的数组
        $repeat_arr = array_diff_assoc ( $data, $unique_arr );
        $str = "'".implode("','",$unique_arr)."'";
//        print_r($repeat_arr);exit;
        print_r($str);
    }
    public function test(){
        $i = 0;
        while($i<200) {
            $uri = '192.168.100.'.$i;
            $rs = pingAddress($uri,1);
            if ($rs) {
                $data = '';
                $data .= $uri . ' write at ' . date('Y-m-d H:i:s', time());
                file_put_contents('2.txt', $data . PHP_EOL, FILE_APPEND);
            }
            $i++;
        }
    }

}
